<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@taglib prefix="s" uri="/struts-tags"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>代理信息编辑查看</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="../css/admin_style.css" />
<script type="text/javascript" src="../js/pagination.js"></script>
<script language="javascript" src="../js/validate.js"></script>
<s:head />
</head>
<body>
<div class="wrap">
<div class="admin_info mb10">
	<h3 class="h1"><b>提示信息</b></h3>
	<div class="legend">主要功能:代理配额扣减</div>
</div>
<s:form action="userWithHold" method="post"  onsubmit="return submitForm(this);">
<h2 class="h1"><b>代理编辑查看</b></h2>
<div class="admin_table mb10">
<table>
<tbody>
<tr class="tr1 vt">
    <td class="td1">登陆帐号：</td>
    <td class="td2"><input class="input input_wa" name="user.userAccount" id="wm.account" type="text" value="" dsize="35" minLength="3" maxlength="20" disabled validate="登陆帐号||notnull,minLength,maxlength">*
    </td>
</tr>
</table>
<h2 class="h1"><b>代理配额扣减</b><span style="color:red"><b>（注意：请忽滥用此功能，若因扣款引起纠纷，则一切责任其上级负责，直至冻结帐户！） <a href="/help.jsp" style="color:red;text-decoration:underline;">附：百万平台规范</a></b></span></h2>

<table>
<tr class="tr1 vt">
    <td class="td1">扣减金额：</td>
    <td class="td2"><input class="input input_wa" id="wm.accountBalance" name="userPay.money" value="" size="35" validate="扣款金额||notnull,number">元&nbsp;&nbsp;<span style="color:red">*</span>请谨慎操作！</td>
</tr>
<tr class="tr1 vt">
    <td class="td1">扣减说明：</td>
    <td class="td2"><textarea rows="50" cols="26" style="height:60px;width:150px;" id="remark">金额扣减</textarea></td>
</tr>
</table>
</div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit">提 交</button></span></span>
	<span class="btn"><span><button type="button" onclick="history.go(-1);">返 回</button></span></span>
</div>
<input type="hidden" name="user.userId" id="wm.id" value="${user.userId }">
<s:token  />
</s:form>
<div class="c"></div>
</div>
<script type="text/javascript">
function showConfirm(info,href){
 info = info ;//+ "<br>操作理由：<input type='text' id='____operationReason'><br>操作密匙：<input type='text' id='____operationPassword'>";
 showDialog({type:"confirm",message:info,onOk:function(){
   //var ____operationReason=document.getElementById("____operationReason").value;
   //if(!____operationReason || ____operationReason==""){alert("请输入操作理由");return false;}
   location.href=href;
   //openNewUrl('user'+new Date().getTime(),info,href);
   return true;
 }});
}
var operations=document.getElementsByTagName("a");
for(var i=0;i<operations.length;i++){
    var obj=operations[i];
    var confirmDialog=obj.getAttribute("confirm");
    if(!confirmDialog || confirmDialog!="yes")continue;
    obj.attachEvent("onclick",function(e){
        e=window.event||e;
        var el=e.srcElement;
        //test();
        if(el.href.indexOf("javascript:void")==-1)
        el.href="javascript:void(0);showConfirm('"+"确认执行"+el.innerText+"操作？！"+"','"+el.href+"');"
        return false;
    })
}

var allInputs = document.getElementsByTagName('input');
if(allInputs && allInputs.length>0){
	for(var i=0; i<allInputs.length;i++)
	{
		var ipt = allInputs[i].parentNode;
		if(ipt.tagName=='LI'&& allInputs[i].type=='radio')
		{
			allInputs[i].checked && (ipt.className='current');
			ipt.onclick = function(){radioWithWords(this)};
		}
	}
}
</script>
<script type="text/javascript">
    if (typeof (HTMLElement) != "undefined" && !window.opera) {
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var a = this.attributes, str = "<" + this.tagName, i = 0; for (; i < a.length; i++)
            if (a[i].specified)
                str += " " + a[i].name + '="' + a[i].value + '"';
        if (!this.canHaveChildren)
            return str + " />";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(s);
        this.parentNode.replaceChild(df, this);
        return s;
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
    });
}
if (typeof (HTMLElement) != "undefined" && !window.opera) {
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var a = this.attributes, str = "<" + this.tagName, i = 0; for (; i < a.length; i++)
            if (a[i].specified)
                str += " " + a[i].name + '="' + a[i].value + '"';
        if (!this.canHaveChildren)
            return str + " />";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(s);
        this.parentNode.replaceChild(df, this);
        return s;
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
    });
}
</script>
<script type="text/javascript">
    var valueControls={//能直接用 obj.value赋值的控件名及Type
        "input":"text,password,hidden",
        "select":"select-one",
        "textarea":"textarea"
    };
    var formData={};
	formData["wm.expendMoney"]="0.000000";
	formData["wm.regTime"]="2013-05-08 18:38:01.0";
	formData["wm.STATE_UNACTIVE"]=" can\'t find \'getSTATE_UNACTIVE\' method";
	formData["wm.userGroup.GROUP_TYPE_ADMIN"]=" can\'t find \'getGROUP_TYPE_ADMIN\' method";
	formData["wm.state"]="1";
	formData["wm.userGroup.groupName"]="普通代理";
	formData["wm.passQuestionAnswer"]="";
	formData["wm.userGroup.GROUP_TYPE_AGENT"]=" can\'t find \'getGROUP_TYPE_AGENT\' method";
	formData["wm.userGroup.groupType"]="2";
	formData["wm.account"]="${user.userAccount}";
	formData["wm.id"]="${user.userId}";
	formData["wm.TABLE_NAME"]=" can\'t find \'getTABLE_NAME\' method";
	formData["wm.loginIp"]="27.157.32.77";
	formData["wm.accountBalance"]="";
	formData["wm.userGroup.purview"]="{\"childrenMenus\":[{\"childrenMenus\":[{\"childrenMenus\":[],\"id\":44,\"listOrder\":99,\"menuLevel\":2,\"menuName\":\"扣款消费记录\",\"menuType\":2,\"menuUrl\":\"/agent/accountRecordUI!query.action\",\"methods\":\"__MENU,query\",\"parentMenu\":{\"childrenMenus\":[],\"id\":37,\"listOrder\":0,\"menuLevel\":0,\"menuName\":\"\",\"menuType\":1,\"menuUrl\":\"\",\"methods\":\"\",\"parentMenu\":null}}],\"id\":37,\"listOrder\":99,\"menuLevel\":1,\"menuName\":\"财务概况\",\"menuType\":2,\"menuUrl\":\"#financerecord\",\"methods\":\"__MENU\",\"parentMenu\":{\"childrenMenus\":[],\"id\":1,\"listOrder\":0,\"menuLevel\":0,\"menuName\":\"\",\"menuType\":1,\"menuUrl\":\"\",\"methods\":\"\",\"parentMenu\":null}}],\"id\":1,\"listOrder\":0,\"menuLevel\":0,\"menuName\":\"根菜单\",\"menuType\":0,\"menuUrl\":\"\",\"methods\":\"\",\"parentMenu\":null}";
	formData["wm.userGroup.GROUP_TYPE_WEBMASTER"]=" can\'t find \'getGROUP_TYPE_WEBMASTER\' method";
	formData["wm.operatorId"]="2";
	formData["wm.version"]="8";
	formData["wm.logger"]=" can\'t find \'getLogger\' method";
	formData["wm.loginTimes"]="4";
	formData["wm.USER_TYPE_EMPLOYEE"]=" can\'t find \'getUSER_TYPE_EMPLOYEE\' method";
	formData["wm.balanceSecret"]=" can\'t find \'getBalanceSecret\' method";
	formData["wm.userGroup.id"]="4";
	formData["wm.userGroup.users"]="[]";
	formData["wm.qq"]="765683630";
	formData["wm.email"]="";
	formData["wm.USER_TYPE_AGENT"]=" can\'t find \'getUSER_TYPE_AGENT\' method";
	formData["wm.ww"]="";
	formData["wm.STATE_FREEZED"]=" can\'t find \'getSTATE_FREEZED\' method";
	formData["wm.incomeMoney"]="0.000000";
	formData["wm.STATE_DELETED"]=" can\'t find \'getSTATE_DELETED\' method";
	formData["wm.userGroup.products"]="{\"1001\":{\"price\":50,\"menuUrl\":\"agent/taskManageUI!fanHighSpeed.action\",\"name\":\"高速粉\",\"pid\":2,\"code\":\"1001\"},\"2001\":{\"price\":20,\"menuUrl\":\"agent/taskManageUI!repostHighSpeed.action\",\"name\":\"冲量转\",\"pid\":11,\"code\":\"2001\"},\"2201\":{\"price\":200,\"menuUrl\":\"agent/taskManageUI!praiseHighSpeed.action\",\"name\":\"微博刷赞\",\"pid\":6,\"code\":\"2201\"},\"3001\":{\"price\":200,\"menuUrl\":\"agent/taskManageUI!voteHighSpeed.action\",\"name\":\"活动投票\",\"pid\":13,\"code\":\"3001\"},\"3201\":{\"price\":200,\"menuUrl\":\"agent/taskManageUI!photoLikeHighSpeed.action\",\"name\":\"活动喜欢\",\"pid\":8,\"code\":\"3201\"}}";
	formData["wm.userGroup.listorder"]="99";
	formData["wm.agentLevel"]="2";
	formData["wm.passHintQuestion"]="";
	formData["wm.cashBack"]="0.000000";
	formData["wm.mobile"]="";
	formData["wm.parent"]="";
	formData["wm.products"]="{\"1001\":{\"price\":8,\"menuUrl\":\"agent/taskManageUI!fanHighSpeed.action\",\"name\":\"高速粉\",\"pid\":2,\"code\":\"1001\"},\"2001\":{\"price\":25,\"menuUrl\":\"agent/taskManageUI!repostHighSpeed.action\",\"name\":\"冲量转\",\"pid\":11,\"code\":\"2001\"},\"2201\":{\"price\":70,\"menuUrl\":\"agent/taskManageUI!praiseHighSpeed.action\",\"name\":\"微博刷赞\",\"pid\":6,\"code\":\"2201\"},\"3001\":{\"price\":70,\"menuUrl\":\"agent/taskManageUI!voteHighSpeed.action\",\"name\":\"活动投票\",\"pid\":13,\"code\":\"3001\"},\"3201\":{\"price\":70,\"menuUrl\":\"agent/taskManageUI!photoLikeHighSpeed.action\",\"name\":\"活动喜欢\",\"pid\":8,\"code\":\"3201\"}}";
	formData["wm.password"]="";
	formData["wm.loginTime"]="2013-05-08 19:47:15.0";
	formData["wm.userGroup.GROUP_TYPE_EMPLOYEE"]=" can\'t find \'getGROUP_TYPE_EMPLOYEE\' method";
	formData["wm.STATE_ACTIVE"]=" can\'t find \'getSTATE_ACTIVE\' method";
    for(var id in formData){//铺数据
      var obj=document.getElementById(id);
      if(id && obj){//checkBox
        var tagName=obj.tagName.toLowerCase();
        if(obj.type){
          var type=obj.type.toLowerCase();
          if(valueControls[tagName] && valueControls[tagName].indexOf(type)!=-1){
            if(eval("document.getElementById(\""+id+"\")")){
              document.getElementById(id).value=formData[id];
            }
          }else{
             if(type=="radio" || type=="checkbox"){
              initRadioOrCheckBox(id); 
             }
             if(type=="select-multiple"){
              initMultiSelect(id);
             }
          }
        }else{
           obj.innerHTML=formData[id]; 
        }
      }
    }
    function initRadioOrCheckBox(id){
      var servingTimes=document.getElementsByName(id);
      for(var s=0;s<servingTimes.length;s++){
         if(servingTimes[s].type=="checkbox")
           servingTimes[s].checked=false;
      }
      if(formData[id]){
        var servingTimesValue=formData[id].split(",");
        for(var s=0;s<servingTimesValue.length;s++){
         for(var i=0;i<servingTimes.length;i++){
            if(servingTimes[i].value==servingTimesValue[s].trim())
            servingTimes[i].checked=true;
         }
       }
      }else{
       for(var i=0;i<servingTimes.length;i++){
         if(servingTimes[i].type=="checkbox")
           servingTimes[i].checked=true;
       }
      }
   }
   function initMultiSelect(id){
      var selOptions=document.getElementById(id).options;
      for( var i=0;i<selOptions.length;i++){
         selOptions.selected=false;
      }
      if(formData[id]){
        var selOptionsValue=formData[id].split(",");
        for(var s=0;s<selOptionsValue.length;s++){

         for(var i=0;i<selOptions.length;i++){
            if(selOptions[i].value==selOptionsValue[s].trim())
            selOptions[i].selected=true;
         }
       }
      }else{
       for(var i=0;i<selOptions.length;i++){
         selOptions[i].selected=false;
       }
      }
   }
</script>    
<script type="text/javascript">
function getQueryString(form,param) {
        var datastring = '';
        var inputs = form.getElementsByTagName('INPUT');
        for (var i = 0; i < inputs.length; i++) {
            if(inputs[i].name==param)continue;
            
            switch (inputs[i].getAttribute('type')) {
                case 'text':
                    datastring = plamostr(inputs[i], datastring);
                    break;
                case 'hidden':
                    datastring = plamostr(inputs[i], datastring);
                    break;
                case 'checkbox':
                    if (inputs[i].checked) {
                        datastring = plamostr(inputs[i], datastring);
                    }
                    break;
                case 'radio':
                    if (inputs[i].checked) {

                        datastring = plamostr(inputs[i], datastring);
                    }
                    break;
            }
        }
        var textareas = form.getElementsByTagName('TEXTAREA');
        for (var i = 0; i < textareas.length; i++) {
            datastring = plamostr(textareas[i], datastring);
        }
        var selectes = form.getElementsByTagName('SELECT');
        for (var i = 0; i < selectes.length; i++) {
            datastring = plamostr(selectes[i], datastring);
        }
        if(param){
            document.getElementById(param).value=datastring;
        }
        return datastring;
    }
    function plamostr(object, datastring) {
        /**
         *拼装Form数据字符串
         */
        if (datastring.length > 0) {
            datastring += '&' + object.getAttribute('name') + '=' + object.value;
        } else {
            datastring += object.getAttribute('name') + '=' + object.value;
        }
        return datastring;
    }
</script><script type="text/javascript">
    function submitForm(form){
       if(!frmSubmit(form))return false;
       var balance=document.getElementById("wm.accountBalance").value;
       var account=document.getElementById("wm.account").value;
       if(balance<=0){
          alert("请输入大于零的数字！");
          return false;
       }
       if(!confirm("确认为用户【"+account+"】扣款【"+balance+"】元？")){
          return false;
       }  
      return true;
    }
    document.getElementById("wm.accountBalance").click();
    document.getElementById("wm.accountBalance").focus();
</script>
</body></html>
